function quicksort(arr) {
    if (arr.length <= 1) return arr;
    let pivotIndex = Math.floor(arr.length / 2);
    let pivot = arr.splice(pivotIndex, 1)[0];
    let left = [];
    let right = [];
    arr.forEach(el => {
        if (el < pivot) {
            left.push(el)
        } else {
            right.push(el)
        }
    });
    return quicksort(left).concat(pivot, quicksort(right))
}

function bubblesort(arr) {
    for (let i = 0; i < arr.length; i++) {
        for (let j = 0; j < arr.length - i - 1; j++) {
            if(arr[j]>arr[j+1]){
                let tem = arr[j];
                arr[j] = arr[j+1];
                arr[j+1] = tem;
            }
        }
    }
    return arr;
}